using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using AvaloniaApplication1.Models;
using AvaloniaApplication1.ViewModel;
using ReactiveUI;

namespace AvaloniaApplication1.Views
{
    public class TestSubWindow : Window
    {


        public TestSubWindow()
        {
            InitializeComponent();
            this.Closed += TestSubWindow_Closed;
            MessageAggregator<Student>.Subscribe(OnStudent);

#if DEBUG
#endif
        }

        private void TestSubWindow_Closed(object sender, System.EventArgs e)
        {
            MessageAggregator<Student>.UnSubscribe(OnStudent);
        }

        public void OnStudent(Student student)
        {
            this.Title = student.FirstName;
        }

        private void InitializeComponent()
        {
            AvaloniaXamlLoader.Load(this);
        }
    }
}
